import 'package:get/get.dart';
import 'package:series_play/comm/base/base_list_controller.dart';

import '../../../comm/comm_constant.dart';

class SearchController extends BaseListController<String> {
  /// 页面类型 0 默认 1搜索结果
  var pageType = 0.obs;

  var hotSearchList = <String>[].obs;
  var hotFireList = <String>[].obs;

  var searchKey = ''.obs;

  @override
  void onReady() {
    super.onReady();
    _loadLocalHistory();
    hotSearchList.value = CommConstant.generateFuckData();
    hotFireList.value = CommConstant.generateFuckData();
  }

  /// 加载本地历史记录
  _loadLocalHistory() {}

  search(String searchKey) {
    this.searchKey.value = searchKey;
    onRefresh();
  }

  clearSearch() {
    dataList.clear();
    pageType.value = 0;
  }

  @override
  Future<List<String>> onLoad(int page, int pageSize, bool isRefresh) async {
    if (isRefresh) {
      pageType.value = 1;
    }
    return CommConstant.generateFuckData();
  }
}
